<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="Bookmark" href="/favicon.ico" >
<link rel="Shortcut Icon" href="/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="/static/h-ui.admin/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<!--/meta 作为公共模版分离出去-->

<title>现场挂号</title>
<meta name="keywords" content="">
<meta name="description" content="">
</head>
<body>
<article class="page-container">
	<form action="" method="get" class="form form-horizontal" id="frmRegist">
		<div class="row cl">
			<!----------- 发票号 ------------------->
			<label class="form-label col-xs-1 col-sm-1">
				<span class="c-red">*</span>发票号：
			</label>
			<div class="formControls col-xs-2 col-sm-2">
				<input type="text" class="input-text" id="invoiceNum" name="invoiceNum"
						th:value="${invoice.invoiceNum}">
				<p>
					<span style="color:red;" th:text="${errInvoice}"></span>
				</p>
			</div>
			<!----------- 挂号 ------------------->
			<div class="formControls col-xs-1 col-sm-1">
				<input class="btn btn-primary radius" type="button" id="btnRegist" name="btnRegist"
					value="&nbsp;&nbsp;挂号&nbsp;&nbsp;">
			</div>
			<!----------- 清空 ------------------->
			<div class="formControls col-xs-2 col-sm-2">
				<input class="btn btn-primary radius" type="button" id="btnRest" name="btnRest"
					value="&nbsp;&nbsp;清空&nbsp;&nbsp;">
			</div>		
			<label class="form-label col-xs-5 col-sm-5"></label>
		</div>
		<div class="row cl">
			<!----------- 挂号信息 ------------------->
			<label class="form-label col-xs-1 col-sm-1" >
				<span style="font-size:16px">挂号信息</span>
			</label>
			<label class="form-label col-xs-7 col-sm-7"></label>
			<!----------- 看诊日期 ------------------->
			<label class="form-label col-xs-2 col-sm-2" >看诊日期：</label>
			<label class="form-label col-xs-2 col-sm-2" style="text-align:left">
				<span style="font-weight:700">
					<!----------- 日期 ------------------->
					<span id="visitDate"
						th:text="${#dates.format(new java.util.Date().getTime,'yyy-MM-dd')}">
					</span>
					<input type="hidden" name="visitDate"
						th:value="${#dates.format(new java.util.Date().getTime,'yyy-MM-dd')}">
					<!----------- 午别 ------------------->
					<span id="registNoon" style="margin-left:25px"></span>
					<input type="hidden" id="noon" name="noon">
				</span>
			</label>
		</div>
		<div class="row cl">
			<hr>
		</div>
		
		<div class="row cl">
			<!----------- 病历号 ------------------->
			<label class="form-label col-xs-1 col-sm-1">
				<span class="c-red">*</span>病历号：
			</label>
			<div class="formControls col-xs-2 col-sm-2">
				<input type="text" class="input-text" id="caseNumber" name="caseNumber"
					th:value="${caseNumber}" >
			</div>
			<!----------- 病历查询 ------------------->
			<div class="formControls col-xs-1 col-sm-1">
				<input class="btn btn-primary radius" type="button" id="btnQuery"
				value="&nbsp;&nbsp;病历查询&nbsp;&nbsp;">
			</div>	
		</div>
		
		<div class="row cl">
			<!----------- 姓名 ------------------->
			<label class="form-label col-xs-1 col-sm-1"><span class="c-red">*</span>姓名：</label>
			<div class="formControls col-xs-2 col-sm-2">
				<input type="text" class="input-text"  id="realName" 
				name="realName" th:value="${regist.realName}">
			</div>
			<!----------- 性别 ------------------->
			<label class="form-label col-xs-1 col-sm-1"><span class="c-red">*</span>性别：</label>
			<div class="formControls col-xs-2 col-sm-2">
				<div class="radio-box" style="padding:0;">
					<input name="gender" type="radio" id="sex71"  value="71" 
						th:checked="${regist.gender==71}">
					<label for="sex1">男</label>
				</div>
				<div class="radio-box">
					<input type="radio" id="sex72" name="gender"  value="72" 
						th:checked="${regist.gender==72}">
					<label for="sex0">女</label>
				</div>
			</div>
			<label class="form-label col-xs-1 col-sm-1"><span class="c-red">*</span>出生日期：</label>
			<div class="formControls col-xs-2 col-sm-2">
				<input type="text" id="birthday" class="input-text Wdate" autocomplete="off"
					name="birthDate" 
					th:value="${#dates.format(regist.birthDate,'yyyy-MM-dd')}"
					onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'%y-%M-%d'})"
					onchange="setAgeByBirthday(this.value)"
					style="width:120px;">
			</div>
			<label class="form-label col-xs-1 col-sm-1"><span class="c-red">*</span>年龄：</label>
			<div class="formControls col-xs-1 col-sm-1">
				<input type="text" class="input-text" id="age" name="age"
					th:value="${regist.age==0 ? '' : regist.age}">
			</div>
			<div class="formControls col-xs-1 col-sm-1">
				<span class="select-box">
					<select class="select" id="ageType" name="ageType">
						<option value="岁" th:selected="${regist.ageType=='岁'}">岁</option>
						<option value="月" th:selected="${regist.ageType=='月'}">月</option>
						<option value="日" th:selected="${regist.ageType=='日'}">日</option>
					</select>
				</span>
			</div>
		</div>
		<div class="row cl">
			<!----------- 挂号级别 ------------------->
			<label class="form-label col-xs-1 col-sm-1">
				<span class="c-red">*</span>挂号级别：
			</label>
			<div class="formControls col-xs-2 col-sm-2">
				<span class="select-box">
					<select class="select" size="1" name="registLeID">
						<option value="0"><label>请选择挂号级别</label></option>
						<option th:each="registLe:${registLevelList}" 
								th:value="${registLe.id}" 
								th:text="${registLe.registName}"
								th:selected="${registLe.id==regist.registLeID}">
						</option>
					</select>
				</span>
				<p>
					<span style="color:red;" th:text="${errRegistLevel}"></span>
				</p>
			</div>
			<label class="form-label col-xs-1 col-sm-1"><span class="c-red">*</span>挂号科室：</label>
			<div style="float: left; width:200px; margin-right: 15px;">
				<input type="text" class="input-text" id="dept"
						name="deptName"  th:value="${regist.deptName}"/>
				<input type="hidden" name="deptID" id="deptID" th:value="${regist.deptID}">		
				<div id="dropdown" class="ac_results" ></div>	
			</div>
			<div class="formControls col-xs-2 col-sm-2">
				<input class="btn btn-primary radius" type="button" value="医生查询" id="btnQueryScheduling">
			</div>		
			<label class="form-label col-xs-5 col-sm-5"></label>
		</div>
		<div class="row cl">
			<hr>
		</div>
		<div class="page-container">
			<div class="mt-20">
				<table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
					<thead>
						<tr class="text-c">
							<th width="30">选择</th>
							<th width="120">排班日期</th>
							<th width="150">午别</th>
							<th width="120">真实姓名</th>
							<th width="120">医生职称</th>
							<th width="150">所在科室</th>
							<th width="120">挂号级别</th>
						</tr>
					</thead>
					<tbody>
						<tr class="text-c" th:each="scheduling:${schedulingList}" onclick="setFouce(this)">
							<td style="padding:0">
								<input type="radio" name="userId" id="userId"
									th:value="${scheduling.user.id}">
							</td>
							<td th:text="${#dates.format(scheduling.schedDate,'yyyy-MM-dd')}"></td>
							<td th:text="${scheduling.noon}"></td>
							<td class="text-l" th:text="${scheduling.user.realName}"></td>
							<td th:text="${scheduling.user.constantName}"></td>
							<td th:text="${scheduling.user.deptName}"></td>
							<td th:text="${scheduling.user.registName}"></td>
						</tr>		
					</tbody>
				</table>
			</div>	
		</div>	
	</form>
</article>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本--> 
<script type="text/javascript" src="/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
 
 <script type="text/javascript" src="/ext/selectCity/dept.js"></script>
<script type="text/javascript" src="/ext/selectCity/dimensions.js"></script>
<script type="text/javascript" src="/ext/selectCity/suggest.js"></script>
<script type="text/javascript">

/* ==============================用户自定义脚本============================================ */

$('.table-sort').dataTable({
	"lengthMenu":[5,10,15,20],
	"aaSorting": [ [ 1, "desc" ] ],//默认第几个排序
	"StateSave": true,//状态保存
	"paging":true,
	"aoColumnDefs": [
	  //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
	  {"orderable":false,"aTargets":[0,6]}// 不参与排序的列
	]
});
function amPm(date){
	return date.getHours()>12 ? '下午' : '上午';
}

//年月日转换为毫秒
var millYear=1000 * 60* 60* 24* 365;
var millMonth=1000*60*60*24*30;
var millDate=1000*60*60*24;

//根据出生日期设置年龄
function setAgeByBirthday(txtValue){
	var value="";
	var type="岁";
	if(txtValue!=''){
		//生日日期
		var ymd=txtValue.split('-');
		var birthday = new Date(ymd[0],ymd[1]-1,ymd[2]);
		//当前日期
		var now = new Date();
		now= new Date(now.getFullYear(),now.getMonth(),now.getDate());
		//计算年龄
		var milliseconds = now.getTime() - birthday.getTime();
		value=parseInt(milliseconds / millYear);
		if(value<1){
			value=parseInt(milliseconds / millMonth);
			if(value<1){
				value=parseInt(milliseconds / millDate);
				type="日";
			}else{
				type="月";
			}
		}else{
			type="岁";
		}
	}
	$('#age').val(value);
	$('#ageType').val(type);
}

function setFouce(node){
	$(node).children().children().first().prop('checked' ,true);
}

$('#btnQueryScheduling').click(function(){
	$('#realName').rules("remove","required");
	$('#age').rules("remove","required");
	$('#dept').rules("remove","required");
	
	$('#frmRegist').attr('action','/rg/schedulingInfo');
	var form = document.getElementById("frmRegist");
	form.submit();
});

$('#btnQuery').click(function(){alert();
	$('#realName').rules("remove","required");
	$('#age').rules("remove","required");
	$('#dept').rules("remove","required");
	
	$('#frmRegist').attr('action','/rg/caseInfo');
	var form = document.getElementById("frmRegist");
	form.submit();
});

$('#btnRegist').click(function(){
	$('#realName').rules("add",{
		required:true
	});
	$('#age').rules("add",{
		required:true
	});
	$('#dept').rules("add",{
		required:true
	});
	
	$('#frmRegist').attr('action','/rg/doRegist');
	var form = document.getElementById("frmRegist");
	form.submit();
});

$('#btnReset').click(function(){
	window.location.replace('/rg/regist');
});


$(function(){
	$("#dept").suggest(citys,{
		hot_list:commoncitys,
		dataContainer:'#deptID',
		onSelect:function(){
			$("#dept").click()},
		attachObject:'#dropdown'}
	);
	
	$('#registNoon').text(amPm(new Date()));
	$('#noon').val(amPm(new Date()));
	
	
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$("#frmRegist").validate({
		rules:{
			realName:{
				required:true,
			},
			age:{
				required:true,
				number:true
			}
			,
			dept:{
				required:true,
			},
			
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			//$(form).ajaxSubmit();
			var index = parent.layer.getFrameIndex(window.name);
			//parent.$('.btn-refresh').click();
			parent.layer.close(index);
		}
	});
	
});
</script> 
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>